package com.enjoyor.soa.traffic.server.tpcms.dubbo.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.enjoyor.soa.traffic.api.dto.tpcms.PassCardDto;
import com.enjoyor.soa.traffic.api.service.dubbo.tpcms.IDubboPassCardService;
import com.enjoyor.soa.traffic.core.tpcms.service.IPassCardService;
import com.enjoyor.soa.traffic.util.pojo.Page;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

@Service(version = "1.0.0", timeout = 4000)
public class DubboPassCardService implements IDubboPassCardService {

    @Autowired
    private IPassCardService passCardService;

    /**
     * 新增通行证
     */
    @Override
    public ResultPojo insertPassCard(PassCardDto passCardDto, String userName) {
        return new ResultPojo(passCardService.insertPassCard(passCardDto, userName));
    }

    /**
     * 删除通行证
     */
    public ResultPojo deletePassCard(String passCardId, String userName) {
        return new ResultPojo(passCardService.deletePassCard(passCardId, userName));
    }

    /**
     * 修改通行证状态
     */
    public ResultPojo editPassCardStatus(String passCardId, String passStatusId, String extensionPeople, String isSelf,
            String extensionDays, String userName) {
        return new ResultPojo(passCardService.editPassCardStatus(passCardId, passStatusId, extensionPeople, isSelf,
                extensionDays, userName));
    }

    /**
     * 查询通行证列表信息
     */
    @Override
    public ResultPojo getPassCardList(String passCardId, String passApplyId, String effectStartTime,
            String effectEndTime, String passStatusId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("passCardId", passCardId);
        map.put("passApplyId", passApplyId);
        /*
         * map.put("applyPeople", applyPeople); map.put("applyDept", applyDept);
         * map.put("licenseNumber", licenseNumber);
         */
        map.put("effectStartTime", effectStartTime);
        map.put("effectEndTime", effectEndTime);
        map.put("passStatusId", passStatusId);
        // List<PassCardDto> passCardList =
        // passCardService.getPassCardList(map);
        return new ResultPojo(passCardService.getPassCardList(map));
    }

    /**
     * 查询当年通行证最大编号
     */
    public ResultPojo getMaxPassCardId() {
        return new ResultPojo(passCardService.getMaxPassCardId());
    }

    /**
     * 查询通行证分页信息
     */
    @SuppressWarnings("rawtypes")
    @Override
    public ResultPojo getPassCardPage(Page page) {
        return new ResultPojo(passCardService.getPassCardPage(page));
    }

}
